<template lang="pug">
  v-data-table( :headers="headers"
    v-model="selected"
    show-select
    :options.sync="options"
    :items="items"
    loading-text="数据加载中..."
    no-data-text="未找到数据"
    :server-items-length="totalItems"
    :footer-props="footerProps"
    :loading="isLoading"
  )
    template(v-slot:item.action='{ item }')
      v-btn( depressed fab dark x-small color="primary" @click="edit(item)")
        v-icon(small) mdi-square-edit-outline
</template>

<script lang="ts">
  import Vue from 'vue'
  import mixins from '../mixins/PaginateDataTableMixin'
  import {mapState, mapMutations, mapGetters, mapActions} from 'vuex'

  export default Vue.extend({
    mixins: [mixins],
    methods: {
      ...mapActions('assetBundle', { fetchData: 'list' }),
      edit(item: any) {
        this.$emit('edit', item)
      }
    },
    data() {
      return {
        assetStock: null,
        headers: [
          { text: '操作', value: 'action', sortable: false },
          { text: '名称', value: 'name', width: 200 },
          { text: '描述', value: 'description' }
        ]
      }
    }
  })
</script>
